﻿@page
@{ Layout = "_Layout"; }

<el-card>
    <el-form :inline="true" :size="euiSize">
        <el-form-item label="">
            <el-input v-model="formInline.keyword" placeholder="关键字" prefix-icon="el-icon-search" clearable></el-input>
        </el-form-item>
        <el-form-item>
            <el-button icon="el-icon-search" type="primary" v-on:click="btnSearchClick">查 询</el-button>
            <el-button plain icon="el-icon-plus" type="primary" v-on:click="btnEditClick(0)">发布问卷</el-button>
        </el-form-item>
        <el-form-item>
        </el-form-item>
    </el-form>
    <el-table ref="paperTable" :data="paperList" :size="euiSize"
              style="width: 100%" :height="$(window).height()-160">
        <el-table-column label="#"
                         type="index"
                         width="60"
                         align="center">
            <template scope="scope">
                <span>{{(formInline.pageIndex - 1) * formInline.pageSize + scope.$index + 1}}</span>
            </template>
        </el-table-column>
        <el-table-column prop="title" label="问卷名称" show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="examBeginDateTime" label="有效期" width="150">
            <template slot-scope="scope">
                <div>{{ scope.row.examBeginDateTime }}</div>
                <div>{{ scope.row.examEndDateTime }}</div>
            </template>
        </el-table-column>
        <el-table-column prop="createdDate" label="创建时间"
                         width="150">
        </el-table-column>
        <el-table-column label="状态" width="85">
            <template slot-scope="scope">
                <span v-if="scope.row.locked"><el-tag size="mini" type="danger" effect="dark">已停用</el-tag></span>
                <span v-else><el-tag size="mini" type="success" effect="dark">启 用</el-tag></span>
            </template>
        </el-table-column>
        <el-table-column width="93">
            <template slot-scope="scope">
                <el-dropdown :show-timeout="0" placement="left">
                    <el-button size="mini" v-on:click.stop="return false">
                        操作<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item icon="el-icon-edit" v-on:click.native="btnEditClick(scope.row.id)">修改</el-dropdown-item>
                        <el-dropdown-item icon="el-icon-document-copy" v-on:click.native="btnCopyClick(scope.row.id)">复制</el-dropdown-item>
                        <el-dropdown-item icon="el-icon-unlock" v-if="scope.row.locked" v-on:click.native="btnUnLockClick(scope.row.id)">启用</el-dropdown-item>
                        <el-dropdown-item icon="el-icon-lock" v-else v-on:click.native="btnLockClick(scope.row.id)">停用</el-dropdown-item>
                        <el-dropdown-item icon="el-icon-delete" style="color:red;" v-on:click.native="btnDeleteClick(scope.row.id)">删除</el-dropdown-item>
                        <el-dropdown-item icon="el-icon-picture-outline" v-on:click.native="btnQrcodeClick(scope.row.id)" v-if="scope.row.published">二维码</el-dropdown-item>
                        <el-dropdown-item icon="el-icon-view" v-on:click.native="btnViewClick(scope.row)">预览统计</el-dropdown-item>
                        <el-dropdown-item icon="el-icon-view" v-on:click.native="btnViewUserClick(scope.row)" v-if="!scope.row.published">用户列表</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </template>
        </el-table-column>
        @await Html.PartialAsync("_PartialTableEmpty")
    </el-table>

    <div style="text-align: center; margin-top: 10px;">
        <el-pagination v-on:current-change="handleCurrentChange" background
                       :current-page="formInline.pageIndex"
                       :page-size="formInline.pageSize"
                       layout="total, prev, pager, next, jumper"
                       :total="paperTotal">
        </el-pagination>
    </div>
</el-card>
@section Scripts{
  <script src="/sitefiles/assets/js/admin/exam/examQuestionnaire.js" type="text/javascript"></script>
}